home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Prog
/
M
/
MacOberon241.cpt
/
MacOberon 2.4(1)
/
Automatic.Mod
(
.txt
)
< prev
next >
Wrap
Oberon Text
|
1991-10-17
|
1KB
|
33 lines
Syntax10.Scn.Fnt
MODULE Automatic; (* Michael Franz, 3.11.90 *)
(* A simple macro facility for executing several commands at once.
Example:
Automatic.Do
System.Directory *.Mod
System.ShowCommands System ~
Browser.ShowDef TextFrames ~
~
IMPORT
Display, Texts, Viewers, Oberon;
W: Texts.Writer;
PROCEDURE NextLine(text: Texts.Text; pos: LONGINT): LONGINT;
VAR R: Texts.Reader; ch: CHAR;
BEGIN
IF pos < text.len THEN Texts.OpenReader(R, text, pos); Texts.Read(R, ch);
WHILE ~ R.eot & (ch # 0DX) DO Texts.Read(R, ch) END;
IF R.eot THEN RETURN -1 ELSE RETURN Texts.Pos(R) END
ELSE RETURN -1 END
END NextLine;
PROCEDURE Do*;
VAR S: Texts.Scanner; text: Texts.Text; vwr: Viewers.Viewer; frame: Display.Frame; pos: LONGINT; par: Oberon.ParList; res: INTEGER;
BEGIN Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S);
NEW(par); vwr := Oberon.Par.vwr; frame := Oberon.Par.frame; text := Oberon.Par.text;
WHILE S.class = Texts.Name DO par.vwr := vwr; par.frame := frame; par.text := text; par.pos := Texts.Pos(S) - 1; pos := NextLine(text, par.pos);
Texts.WriteString(W, "Auto> "); Texts.WriteString(W, S.s); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf);
Oberon.Call(S.s, par, FALSE, res);
IF pos > 0 THEN Texts.OpenScanner(S, text, pos); Texts.Scan(S) ELSE S.class :=Texts.Inval END
END
END Do;
BEGIN Texts.OpenWriter(W);
END Automatic.